package org.sean.framework.alibaba.config;

import com.alibaba.cloud.nacos.NacosConfigManager;
import com.alibaba.cloud.nacos.client.NacosPropertySourceLocator;
import org.sean.framework.alibaba.nacos.MyNacosPropertySourceLocator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * 自动配置
 */
@Configuration
@ConditionalOnProperty(name = "spring.cloud.nacos.config.enabled", matchIfMissing = true)
public class AlibabaBootstrapConfiguration {

    @Primary
    @Bean
    public NacosPropertySourceLocator nacosSourceLocator(NacosConfigManager nacosConfigManager) {
        return new MyNacosPropertySourceLocator(nacosConfigManager);
    }
}
